﻿<!--  Footer Start -->
<footer>
    <div class="footer-content">
        <div class="container">
            <div class="row">
                <div class="col-md-4">
                    <h4>@GetWebSiteName()</h4>
                    <h5>@GetWebSiteTagline()</h5>
                </div>
                <div class="col-md-4">
                    @{
                        var menusFooter = GetMenus("Footer", CurrentLanguage);
                        <!-- Footer Menu Start -->
                        if (menusFooter != null && menusFooter.Count > 0)
                        {
                            <div class="two-column-div">
                                @foreach (var item in menusFooter)
                                {
                                    foreach (var menuItem in item.MenuItems)
                                    {
                                        <a href="@menuItem.Url">@menuItem.Name</a><br />
                                        foreach (var mi2 in menuItem.Childrens)
                                        {
                                            <span>--</span><a href="@mi2.Url">@mi2.Name</a><br />
                                            foreach (var mi3 in mi2.Childrens)
                                            {
                                                <span>----</span><a href="@mi3.Url">@mi3.Name</a><br />
                                                foreach (var mi4 in mi3.Childrens)
                                                {
                                                    <span>------</span><a href="@mi4.Url">@mi4.Name</a><br />
                                                }
                                            }
                                        }
                                    }
                                }
                            </div>
                        }
                        <!-- Footer Menu End -->
                    }
                </div>
                <div class="col-md-4">
                    @{
                        var zoneFooterWidgets = GetWebSiteWidgets(CurrentLayout, "Footer");
                    <!-- Footer Widgets Start -->
                        if (zoneFooterWidgets != null && zoneFooterWidgets.Count > 0)
                        {
                            <div style="float:right;">
                                @foreach (var item in zoneFooterWidgets)
                                {
                                    var widget = item.Widget;
                                    widget.Init(item.Id);
                                    if (string.IsNullOrEmpty(widget.Language) || string.IsNullOrEmpty(CurrentLanguage) || CurrentLanguage == widget.Language)
                                    {
                                        if (widget.DisplayTitle != "" || widget.Footer != "")
                                        {
                                            <div class='panel panel-default'>
                                                @if (widget.DisplayTitle != "")
                                                {
                                                    <div class='panel-heading'>
                                                        @_T[widget.DisplayTitle]
                                                    </div>
                                                }
                                                <div class='panel-body'>
                                                    @Html.Raw(widget.RenderBody())
                                                </div>
                                                @if (widget.Footer != "")
                                                {
                                                    <div class='panel-footer'>
                                                        @_T[widget.Footer]
                                                    </div>
                                                }
                                            </div>
                                        }
                                        else
                                        {
                                            <div>
                                                @Html.Raw(widget.RenderBody())
                                            </div>
                                        }
                                    }
                                }
                            </div>
                        }
                    <!-- Footer Widgets End -->
                    }
                </div>

            </div>
        </div>
    </div>
    <div class="footer-bottom">
        <div class="container">
            <div class="row">
                <div class="col-md-6 copyright"> @_T["Copyrights"] &copy; @Html.Raw(GetWebSiteCopyright()) @_T[DateTime.Now.Year.ToString()]</div>
                <div class="col-md-6 poweredby"> @Html.Raw(string.Format(_T["Developed using {0}"].ToString(), "<a href=\"" + NccInfo.Website + "\" target=\"_blank\">NetCoreCMS" + " v" + NccInfo.Version + "</a>"))</div>
            </div>
        </div>
    </div>
</footer>
<!--  Footer End -->

<script type="text/javascript">
    $(document).ready(function () {
        var didScroll = true;

        $(window).scroll(function () {
            didScroll = true;
        });
        setInterval(function () {
            if (didScroll) {
                didScroll = false;
                var scroll = $(window).scrollTop();
                //console.log(scroll);
                //Same that all the if else statements
                switch (true) {
                    case (scroll >= 200):
                        $("#mainNavbar").addClass("navbar-fixed-top");
                        $("#navbarWebsiteName").removeClass("navbar-brand-with-top-menu");
                        break;
                    case (scroll <= 70):
                        $("#mainNavbar").removeClass("navbar-fixed-top");
                        $("#navbarWebsiteName").addClass("navbar-brand-with-top-menu");
                        break;
                    default:
                        break;
                }
            }
        }, 50);

        var isMenuActive = false;
        $('.ncc-main-menu').find('a').each(function () {
            var pathname = decodeURI(window.location.pathname);
            var pathnameLang = "/@CurrentLanguage" + pathname;

            if (pathname == '/CmsHome') {
                pathname = "/";
                pathnameLang = "/@CurrentLanguage/";
            }
            if ($(this).attr('href') == pathname || $(this).attr('href') == pathnameLang) {
                $(this).parents("li").addClass('active');
                isMenuActive = true;
            }
            //console.log("href: " + $(this).attr('href'));
            //console.log("path: " + pathname);
            //console.log("lang: " + pathnameLang);
        });

        if (isMenuActive == false) {
            $('.ncc-main-menu').find('a').each(function () {
                var pathname = decodeURI(window.location.pathname) + "/Index";
                var pathnameLang = "/@CurrentLanguage" + pathname + "/Index";

                if ($(this).attr('href') == pathname || $(this).attr('href') == pathnameLang) {
                    $(this).parents("li").addClass('active');
                    isMenuActive = true;
                }
            });
        }

        //console.log(isMenuActive);
        if (isMenuActive == false) {
            $('.ncc-main-menu').find('a').each(function () {
                if ($(this).attr('href') == "/" || $(this).attr('href') == "/@CurrentLanguage/") {
                    $(this).parents("li").addClass('active');
                }
            });
        }
    });
</script>